<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

<script type="text/javascript">
	function del(id){
		if(confirm("确定删除该计划？")){
			window.location="delete/"+id;
			return true;
		}
		return false;
	}
	function shou(){window.location="0";}
	function shang(){window.location="${plan.page-1}";}
	function xia(){window.location="${plan.page+1 }";}
	function mo(){window.location="${pages-1 }";}
	function zhu(){window.location.href="main";}
	function go(){
		var s=document.getElementById("to").value-1;
		var el=/^\d*$/;
		if(!el.test(s)||s<0){s=0};
		if(s>${pages-1}){s=${pages-1}}
		window.location=s;
		}
</script>
<style type="text/css">
	body{margin:0px;}
	td{text-align:center;
	padding:5px 8px;
	height:26px;}
	a{text-decoration:none;
	color:red;
	padding:5px 3px;}
	input{font-size:16px;}
	#add{position:absolute;font-size:16px;background-color:green;color:white;
	font-weight:900;padding:15px 16px;right:40px;top:20px;}
	#go{position:absolute;bottom:25px;width:90%;text-align:center;}
	#go button{font-size:20px;padding:3px,10px;}
	#go button:hover{cursor:pointer;background-color:orange;};
</style>
</head>
<body>
<div style="background-color:gray;margin:0px;float:left;width:100%;">
<h1 style="float:left;margin-left:10px;" >控制计划：</h1>
	<form  style="color:white;height:40px;padding:40px 0 0 210px;font-size:20px;"  action="list" method="post">
		计划名称：<input type="text" name="name"/>&nbsp;
		制定人：<input type="text" name="maker"/>&nbsp;
		内容：<input type="text" name="content"/>&nbsp;
		<input type="submit" value="查  询"/>&nbsp;
	</form>
</div>
	<a id="add" href="add">增加控制计划</a>
<table style="width:90%" align="center" cellspacing="0">
	<tr>
		<td>计划ID</td>
		<td>计划名称</td>
		<td>计划完成时间</td>
		<td>计划内容</td>
		<td>计划制定人</td>
		<td>计划状态</td>
		<td>计划制定时间</td>
		<td>总成本</td>
		<td>操作</td>
	</tr>
	<c:forEach items="${list }" var="p" varStatus="shu">
	<tr
	<c:if test="${shu.index%2==0 }">bgcolor="#CCC"</c:if>
	>
		<td><a style="color:blue;" href="detail/${p.id }">${p.no }</a></td>
		<td>${p.name }</td>
		<td>${p.otime }</td>
		<td>${p.content }</td>
		<td>${p.maker }</td>
		<td>
			<c:choose>
				<c:when test="${p.statue==1 }">未开始</c:when>
				<c:when test="${p.statue==2 }">正在进行</c:when>
				<c:when test="${p.statue==3 }">已经完成</c:when>
			</c:choose>
		</td>
		<td>${p.mtime }</td>
		<td>${p.money }￥</td>
		<td><a href="#" onclick="del(${p.id });">删除</a>&nbsp;
		<a href="one/${p.id }">修改</a></td>
	</tr>
	</c:forEach>
</table>

<div  id="go">
		
				<button onclick="zhu()">返回主界面</button>&nbsp;&nbsp;&nbsp;&nbsp;
			<a  <c:if test="${next==-1 }">hidden="hidden"</c:if> >	
				<button onclick="shou()">首页</button>&nbsp;&nbsp;
				<button <c:if test="${plan.page<=0 }">disabled="disabled"</c:if>  onclick="shang()">上一页</button>&nbsp;&nbsp;
				
				第${plan.page+1 }页/共${pages}页&nbsp;&nbsp;
				<button  <c:if test="${next>=3 }">disabled="disabled"</c:if> onclick="xia()">下一页</button>&nbsp;&nbsp;
				<button onclick="mo()">末页</button>&nbsp;&nbsp;
				
				<input style="width:30px ;" type="text" id="to" />&nbsp;<button onclick="go()">GO</button>
				
			</a>
			<a  <c:if test="${next!=-1 }">hidden="hidden"</c:if> >	
				<button onclick="shou()">首页</button>&nbsp;&nbsp;
			</a>
</div>
</body>
</html>